package javase2.day02.card;

import java.util.ArrayList;
import java.util.List;

public class Player {
  private int id;
  private String name;
  private List<Card> cards = new ArrayList<Card>();
  public Player(int id, String name) {
    this.id = id;
    this.name = name;
  }
  public void add(Card card){
    cards.add(card);
  }
  public String toString() {
    return id+","+name + cards; 
  }
  
  @Override //��д == ����
  public boolean equals(Object obj) {
    if(obj == null){
      return false;
    }
    if(this == obj){
      return true;
    }
    if (obj instanceof Player) {
      Player other = (Player) obj;
      return this.id == other.id;
    }
    return false;
  }
  @Override
  public int hashCode() {
    return id;
  }
  
}
